package acm.pta7;

import java.util.Scanner;

public class T7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int an = sc.nextInt();
        int bn = sc.nextInt();
        int ak = 0, bk = 0;
        for (int i = 0; i < 3; i++) {
            if (sc.nextInt() == 1) {
                bk++;
            } else {
                ak++;
            }
        }
        if (ak == 0) {
            System.out.printf("The winner is b: %d + %d", bn, bk);
        } else if (bk == 0) {
            System.out.printf("The winner is a: %d + %d", an, ak);
        } else {
            if (an > bn) {
                System.out.printf("The winner is a: %d + %d", an, ak);
            } else {
                System.out.printf("The winner is b: %d + %d", bn, bk);
            }
        }
    }
}
